package com.cgl.mapper;

import com.cgl.pojo.ReadingRecord;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.time.LocalDateTime;

@Mapper
public interface ReadingRecordMapper {
    @Insert("insert into user_article_read(articlesId,userId,readTime,isCollect,isLike) values(#{articleId},#{userId},#{readTime},#{isCollect},#{isLike})")
    Boolean addReadingRecord(ReadingRecord readingRecord);
    @Select("select * from user_article_read where articleId=#{articlesId} and userId=#{userId}")
    ReadingRecord getReadingRecord(String articleId,String userId);
    @Update("update user_article_read set readTime=#{readTime} where articleId=#{articlesId} and userId=#{userId}")
    Boolean upDataNewTimeByNow(String articleId, String userId, LocalDateTime readTime);
}
